package com.future.controller;

import com.future.allUtils.utils.UploadUtils;
import com.future.domain.Result;
import com.future.service.Impl.MediaResourceServiceImpl;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
public class UploadFile {
    @Autowired
    private UploadUtils uploadUtils;
    @Autowired
    private MediaResourceServiceImpl mediaResourceService;

    /**
     * @param file
     * @param type 1 图片  2 视频
     * @return 上传后的url
     */
    @PostMapping("/upload")
    public Result uploadFile(MultipartFile file, int type) {
        return Result.ok(uploadUtils.uploadFile(file,type));
    }
}
